<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	xmlns:ui="http://java.sun.com/jsf/facelets">
<h:body styleClass="Corpo" style="font-size:13px;">
	<h:form id="formFiltroAberto">
		<div align="center" class="DivCentralizada"
			style="left: 50%; margin-left: -500px;">
			<div align="center"
				style="float: left; padding-right: 3px; padding-top: 4px;">
				<h:outputLabel value="#{message.label_destino}"
					styleClass="LabelFont" style="margin-left:30px;" />
			</div>
			<div align="center" style="float: left; padding-right: 24px;">
				<p:selectOneMenu value="#{chamadoTela.destinoChamadoFiltro}"
					effect="fade" style="font-size: 13px;">
					<f:selectItem itemLabel="" itemValue="0" />
					<f:selectItems value="#{chamadoTela.destinoChamados}" var="destino"
						itemLabel="#{destino}" itemValue="#{destino}"
						style="font-size: 13px;" />
				</p:selectOneMenu>
			</div>
			<div align="center"
				style="float: left; padding-right: 3px; padding-top: 4px;">
				<h:outputLabel value="#{message.solicita_status}"
					styleClass="LabelFont" style="margin-left:30px;" />
			</div>
			<div align="center" style="float: left; padding-right: 24px;">
				<p:selectOneMenu value="#{chamadoTela.statusFiltro}" effect="fade"
					style="font-size: 13px;">
					<f:selectItem itemLabel="" itemValue="0" />
					<f:selectItem itemLabel="Aberto" itemValue="Aberto" />
					<f:selectItem itemLabel="Aguardando Aprovação"
						itemValue="Aguardando Aprovação" />
					<f:selectItem itemLabel="Em Andamento" itemValue="Em Andamento" />
					<f:selectItem itemLabel="Negado" itemValue="Negado" />
				</p:selectOneMenu>
			</div>
			<div
				style="margin-top: 5px; padding-left: 12px; padding-right: 24px; float: left; clear: both;">
				<p:commandButton value="#{message.botao_filtrar}"
					icon="ui-icon-search" style="margin-left:30px; font-size: 14px;"
					action="#{chamadoTela.filtraAbertos}" update=":formChAbe" />
			</div>
		</div>
	</h:form>



	<div align="left" style="padding-left: 3px; padding-top: 8px;">
		<h:form id="formChAbe">
			<p:dataTable var="chamado" id="idTChAbe"
				value="#{chamadoTela.chamadosAberto}"
				paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
				rowsPerPageTemplate="10,15,20" rows="10" paginator="true"
				rowStyleClass="#{chamadoTela.pintaLinha(chamado)}"
				rowKey="#{chamado.codigo}" emptyMessage="#{message.msg_semvalores}">

				<f:facet name="header">
					<div style="float: left;">
						<div style="padding-top: 2px; float: left">
							<h:outputText value="#{message.msg_legenda}  "
								style="font-size: 11px;" />
						</div>
						<p:graphicImage style="padding-left:10px" id="neg"
							value="img/negada.jpg" />
						<p:tooltip for="neg" value="#{message.solicita_statusNega}"
							showEffect="fade" hideEffect="fade" />

						<p:graphicImage style="padding-left:10px" id="blo"
							value="img/bloqueada.jpg" />
						<p:tooltip for="blo" value="#{message.label_aguardando}"
							showEffect="fade" hideEffect="fade" />

						<p:graphicImage style="padding-left:10px" id="abe"
							value="img/aprovada.jpg" />
						<p:tooltip for="abe" value="#{message.label_aberto}"
							showEffect="fade" hideEffect="fade" />

						<p:graphicImage style="padding-left:10px" id="and"
							value="img/andam.jpg" />
						<p:tooltip for="and" value="#{message.label_andamento}"
							showEffect="fade" hideEffect="fade" />
							
						<p:graphicImage style="padding-left:10px" id="conc"
							value="img/comprada.jpg" />
						<p:tooltip for="conc" value="#{message.label_atendido}"
							showEffect="fade" hideEffect="fade" />

					</div>

				</f:facet>

				<p:column style="width:4%">
					<p:rowToggler />
				</p:column>

				<p:column sortBy="#{chamado.codigo}" style="width:10%">
					<f:facet name="header">  
                    #{message.label_num_chamado} 
            		</f:facet>
					<h:outputText value="#{chamado.codigo}" />
				</p:column>

				<p:column sortBy="#{chamado.tipoProblema.destinoChamado}"
					style="width:10%">
					<f:facet name="header">  
                    #{message.label_destino} 
            		</f:facet>
					<h:outputText value="#{chamado.tipoProblema.destinoChamado}" />
				</p:column>

				<p:column sortBy="#{chamado.tipoProblema.descricao}"
					style="width:10%">
					<f:facet name="header">  
                    #{message.label_assunto} 
            		</f:facet>
					<h:outputText value="#{chamado.tipoProblema.descricao}" />
				</p:column>

				<p:column sortBy="#{chamado.dataEmissao}" style="width:10%">
					<f:facet name="header">  
                    #{message.solicita_dt_emissao } 
            		</f:facet>
					<h:outputText
						value="#{chamadoTela.converteData(chamado.dataEmissao)}" />
				</p:column>

				<p:column sortBy="#{chamado.dataAprovacao}" style="width:10%">
					<f:facet name="header">  
                    #{message.label_dt_aprova } 
            		</f:facet>
					<h:outputText
						value="#{chamadoTela.converteData(chamado.dataAprovacao)}" />
				</p:column>


				<p:column style="width:10%">

					<f:facet name="header">  
                    #{message.label_acoes} 
            		</f:facet>

					<p:commandButton id="butAnexo" styleClass="ButtonPesq"
						icon="ui-icon-arrowthickstop-1-s" ajax="false"
						rendered="#{chamado.arquivo != null ? true : false}">
						<p:fileDownload value="#{chamadoTela.downloadArquivo(chamado)}" />
					</p:commandButton>

					<p:commandButton id="butHist" icon="ui-icon-search"
						styleClass="ButtonPesq" style="margin-left: 10px;"
						action="#{chamadoTela.preencheHistorico(chamado)}"
						oncomplete="dlgHist.show();" update=":descHist"
						rendered="#{chamado.historicos.size() > 0 ? true : false}" />


					<p:commandButton id="butEdita" icon="ui-icon-pencil"
						styleClass="ButtonPesq" style="margin-left: 10px;"
						update=":formEditaChamado:editorEditar"
						rendered="#{chamado.status.equals('Aguardando Aprovação') || chamado.status.equals('Negado') ? true : false}"
						oncomplete="dlg13.show();">
						<f:setPropertyActionListener target="#{chamadoTela.chamado}"
							value="#{chamado}" />
					</p:commandButton>

					<p:commandButton id="butExclui" icon="ui-icon-trash"
						styleClass="ButtonPesq" oncomplete="excluiChamado.show()"
						style="margin-left: 10px;"
						rendered="#{chamado.status.equals('Aguardando Aprovação') || chamado.status.equals('Negado') ? true : false}">
						<f:setPropertyActionListener target="#{chamadoTela.chamado}"
							value="#{chamado}" />
					</p:commandButton>

					<p:tooltip for="butExclui" value="#{message.botao_excluir}"></p:tooltip>
					<p:tooltip for="butEdita" value="#{message.botao_editar}"></p:tooltip>
					<p:tooltip for="butHist" value="#{message.label_ver_historico}"></p:tooltip>
					<p:tooltip for="butAnexo" value="#{message.label_anexo}"></p:tooltip>

				</p:column>

				<p:rowExpansion>

					<div style="margin-top: 30px;">
						<div style="float: left; padding-left: 8px;">
							<h:panelGrid columns="2" cellpadding="1" style="width:300px;"
								columnClasses="label, value">


								<h:outputText style="font-weight: bold;"
									value="#{message.label_dt_previsao}" />

								<h:outputText
									value="#{chamadoTela.converteData(chamado.dataPrevisao)}" />

								<h:outputText style="font-weight: bold;"
									value="#{message.label_progresso}" />

								<h:outputText value="#{chamado.progresso}%" />

							</h:panelGrid>
						</div>
						<div style="float: left; margin-left: 30px;">
							<h:panelGrid columns="1" cellpadding="1"
								style="width:700px;center;">
								<h:outputText style="font-weight: bold;"
									value="#{message.label_comentario}" />
								<h:outputText escape="false" value="#{chamado.descricao}" />
							</h:panelGrid>
						</div>

						<div style="margin-top: 30px; margin-left: 30px;">

							<div style="float: left; clear: both; margin-top: 30px;">
								<p:commandButton value="#{message.label_finalizar_chamado}"
									action="#{chamadoTela.setChamado(chamado)}"
									icon="ui-icon-check" onclick="dlgFinaliza.show()"
									rendered="#{chamado.progresso == 100 ? true : false}" />


							</div>
						</div>
					</div>


				</p:rowExpansion>

				<f:facet name="footer">
					<div style="float: left;">
						<div style="padding-top: 2px; float: left">
							<h:outputText value="#{message.msg_legenda}  "
								style="font-size: 11px;" />
						</div>
						<p:graphicImage style="padding-left:10px" id="neg2"
							value="img/negada.jpg" />
						<p:tooltip for="neg2" value="#{message.solicita_statusNega}"
							showEffect="fade" hideEffect="fade" />

						<p:graphicImage style="padding-left:10px" id="blo2"
							value="img/bloqueada.jpg" />
						<p:tooltip for="blo2" value="#{message.label_aguardando}"
							showEffect="fade" hideEffect="fade" />

						<p:graphicImage style="padding-left:10px" id="abe2"
							value="img/aprovada.jpg" />
						<p:tooltip for="abe2" value="#{message.label_aberto}"
							showEffect="fade" hideEffect="fade" />

						<p:graphicImage style="padding-left:10px" id="and2"
							value="img/andam.jpg" />
						<p:tooltip for="and2" value="#{message.label_andamento}"
							showEffect="fade" hideEffect="fade" />
							
						<p:graphicImage style="padding-left:10px" id="conc2"
							value="img/comprada.jpg" />
						<p:tooltip for="conc2" value="#{message.label_atendido}"
							showEffect="fade" hideEffect="fade" />
					</div>
				</f:facet>



			</p:dataTable>

			<p:confirmDialog message="#{message.msg_exclui_chamado}"
				header="#{message.header_exclui_chamado}" severity="alert"
				widgetVar="excluiChamado" appendToBody="true">
				<p:commandButton id="confirm" value="#{message.msg_sim}"
					actionListener="#{chamadoTela.excluiChamado}" global="false"
					update=":messages,@form" onclick="excluiChamado.hide();" />
				<p:commandButton id="decline" value="#{message.msg_nao}"
					onclick="excluiChamado.hide();" type="button" global="false" />
			</p:confirmDialog>

		</h:form>
	</div>
</h:body>

</html>
